package com.swpu.oss.Controller;

import com.swpu.commonutils.R;
import com.swpu.oss.Service.Osservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 功能描述：
 *
 * @Author: ygq
 * @Date: 2021/10/13 22:51
 */
@RestController
@CrossOrigin
@RequestMapping("/eduoss/fileoss")
public class ossController {
    @Autowired
    private Osservice osservice;

    @PostMapping
    public R uploadOssFile(MultipartFile file){
        //获取文件 file
       String url =  osservice.uploadFile(file);
        return R.ok().data("url",url);
    }
}
